package org.softmed.action.tree;

import org.softmed.action.Action;
import org.softmed.action.pool.ActionPool;

public class ActionContainerNode extends ActionPool implements Node {

	public Action getAction() throws Throwable {
		return getActionFromPool();
	}

	public void setAction(Action action) {
		setOriginal(action);
	}

	public void dispose() {
		clear();
		setOriginal(null);
	}

	// this is a limited clone function - the registry isn't cloned
	// this will be used only when cloning tree's from modules to application
	@Override
	public Node getClone() throws Throwable {
		ActionContainerNode clone = new ActionContainerNode();
		clone.setInc(getInc());
		clone.setStart(getStart());
		clone.setAction(getOriginal().clone());
		clone.setActionConfigurator(actionConfigurator.clone());
		return clone;
	}

	@Override
	public void rebuildPools() throws Throwable {
		rebuild();
	}

	@Override
	public void setPoolIncrementSize(int size) {
		setInc(size);

	}

	@Override
	public void setPoolStartSize(int size) {
		setStart(size);
	}

}
